# eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.GoogleV1Engine

Module implementing the Google V1 translation engine.

### Global Attributes

None

### Classes

GoogleV1Engine | Class implementing the translation engine for the old Google translation service.

### Functions

createEngine | Function to instantiate a translator engine object.

## GoogleV1Engine

Class implementing the translation engine for the old Google translation service.

### Derived from

TranslationEngine

### Class Attributes

TextToSpeechLimit
TextToSpeechUrl
TranslatorUrl

### Class Methods

None

### Methods

GoogleV1Engine | Constructor
engineName | Public method to return the name of the engine.
getTextToSpeechData | Public method to pronounce the given text.
getTranslation | Public method to translate the given text.
hasTTS | Public method indicating the Text-to-Speech capability.
supportedLanguages | Public method to get the supported languages.

### Static Methods

None

#### GoogleV1Engine (Constructor)

GoogleV1Engine(plugin, parent=None)

Constructor

plugin (TranslatorPlugin)
  reference to the plugin object
parent (QObject)
  reference to the parent object

#### GoogleV1Engine.engineName

engineName()

Public method to return the name of the engine.

Return:
  engine name

Return Type:
  str

#### GoogleV1Engine.getTextToSpeechData

getTextToSpeechData(requestObject, text, language)

Public method to pronounce the given text.

requestObject (TranslatorRequest)
  reference to the request object
text (str)
  text to be pronounced
language (str)
  language code of the text

Return:
  tuple with pronounce data or error string and success flag

Return Type:
  tuple of (QByteArray or str, bool)

#### GoogleV1Engine.getTranslation

getTranslation(requestObject, text, originalLanguage, translationLanguage)

Public method to translate the given text.

requestObject (TranslatorRequest)
  reference to the request object
text (str)
  text to be translated
originalLanguage (str)
  language code of the original
translationLanguage (str)
  language code of the translation

Return:
  tuple of translated text and flag indicating success

Return Type:
  tuple of (str, bool)

#### GoogleV1Engine.hasTTS

hasTTS()

Public method indicating the Text-to-Speech capability.

Return:
  flag indicating the Text-to-Speech capability

Return Type:
  bool

#### GoogleV1Engine.supportedLanguages

supportedLanguages()

Public method to get the supported languages.

Return:
  list of supported language codes

Return Type:
  list of str

Up

## createEngine

createEngine(plugin, parent=None)

Function to instantiate a translator engine object.

plugin (TranslatorPlugin)
  reference to the plugin object
parent (QObject (optional))
  reference to the parent object (defaults to None)

Return:
  reference to the instantiated translator engine object

Return Type:
  GoogleV1Engine

Up